import threading
from threading import Timer

def consumer():
    r = ''
    while True:
        n = yield r
        # 如果
        if not n:
            return
        print('消费了数字:',n)
        r = '200 OK'

def produce(c):
    c.send(None)
    n = 0
    while n < 5:
        n = n + 1
        print('生产了数字:',n)
        r = c.send(n)
        print('消费者返回了:',n)
    c.close()

c = consumer()
produce(c)